<template>
	<body>
		<div class="loan_nav">
			<ul>
				<li><a href="javascript:history.go(-1)"><i class="iconfont">&#xe61e;</i></a></li>
				<li><p>递交材料</p></li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">
			
		</div>
		<div>
			<img src="@/assets/img/2e0e9be4aa926395ea893308a325e811.jpg"  width="100%"/>
		</div>
		<div class="theme">
			<ul>
				<li><p>主题</p></li>
				<li><input type="text" placeholder="请输入标题（不超过30个字）" /></li>
			</ul>
		</div>
		<div class="add_content">
			<textarea placeholder="请输入添加的增补材料内容" rows="10"></textarea>
		</div>
		<div class="add_foot">
			<ul>
				<li><i class="iconfont col_dr">&#xe6c8;</i></li>
				<input ref="file" type="file" accept="image/*">
				<li><input @click="save" type="button" value="上传" /><div style="clear: both;"></div></li>
			</ul>
		</div>
	</body>
</template>

<script>
export default {
	data() {
		return {

		}
	},
	methods: {
		save() {
			const formData = new FormData()
			formData.append('file', this.$refs.file.files[0])
			this.$http.post('/admin/upload', formData).then(json => {
				const { code, fileUrl } = json
				if(code === 0) {
					this.$http.post('/app/loan/data', {
						id: this.$route.params.id,
						accessory: fileUrl
					}).then(json => {
						const { code } = json
						if(code === 0) {
							this.$vux.toast.show({ text: '材料提交成功' })
							this.$router.back()
						}
					})
				}
			})
		}
	}
}
</script>

<style>
</style>